from django.urls import path, register_converter
from apps.app.views import UsernameCountView, MobileCountView, Register, Logout, Login, Authorization, \
    Broker, UserView, EmailView, EmailVerif, Addr, AddrList, UpdateAddressView, DefaultAddressView, TitleAddressView
from apps.app import views
from apps.app.converters import UsernameConverter, MobileConverter

register_converter(UsernameConverter, 'username')
register_converter(MobileConverter, 'mobile')
urlpatterns = [
    path('usernames/<username:username>/count/', UsernameCountView.as_view()),
    path('mobiles/<mobile:mobile>/count/', MobileCountView.as_view()),
    path('register/', Register.as_view()),
    path('logout/', Logout.as_view()),
    path('login/', Login.as_view()),
    path('broker/<str:broker>', Broker.as_view()),
    path('<str:broker>/authorization/', Authorization.as_view()),
    path('info/', UserView.as_view()),
    path('emails/', EmailView.as_view()),
    path('emails/verification/', EmailVerif.as_view()),
    path('addresses/create/', Addr.as_view()),
    path('addresses/', AddrList.as_view()),
    path('addresses/<int:address_id>/', UpdateAddressView.as_view()),
    path('addresses/<int:address_id>/default/', DefaultAddressView.as_view()),
    path('addresses/<int:address_id>/title/', TitleAddressView.as_view()),
    path('password/', views.UserPasswordView.as_view()),

]
